package com.yun2.bms.model;

import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;

/**
 * author: youli
 * qq: 27855162@qq.com
 * date: 2020/5/18
 * 图书实体类
 */

public class Book {
    //数据库字段
    private final SimpleIntegerProperty id = new SimpleIntegerProperty();
    private final SimpleIntegerProperty categoryId = new SimpleIntegerProperty();
    private final SimpleStringProperty bookName = new SimpleStringProperty("");
    private final SimpleIntegerProperty bookNumber = new SimpleIntegerProperty();
    private final SimpleStringProperty author = new SimpleStringProperty("");
    private final SimpleStringProperty publisher = new SimpleStringProperty("");
    private final SimpleDoubleProperty price = new SimpleDoubleProperty();

    //界面需要字段
    private final SimpleStringProperty categoryName = new SimpleStringProperty("");
    private final SimpleIntegerProperty lendingQuantity = new SimpleIntegerProperty();
    private final SimpleIntegerProperty remainNumber = new SimpleIntegerProperty();

    public Book() {
    }
    public Book(Integer id, Integer categoryId, String bookName, Integer bookNumber,
                String author, String publisher, Double price) {
        setId(id);
        setCategoryId(categoryId);
        setBookName(bookName);
        setBookNumber(bookNumber);
        setAuthor(author);
        setPublisher(publisher);
        setPrice(price);
    }

    public Book(Integer categoryId, String bookName, Integer bookNumber,
                String author, String publisher, Double price) {
        setCategoryId(categoryId);
        setBookName(bookName);
        setBookNumber(bookNumber);
        setAuthor(author);
        setPublisher(publisher);
        setPrice(price);
    }


    public int getId() {
        return id.get();
    }

    public SimpleIntegerProperty idProperty() {
        return id;
    }

    public void setId(int id) {
        this.id.set(id);
    }

    public int getCategoryId() {
        return categoryId.get();
    }

    public SimpleIntegerProperty categoryIdProperty() {
        return categoryId;
    }

    public void setCategoryId(int categoryId) {
        this.categoryId.set(categoryId);
    }

    public String getBookName() {
        return bookName.get();
    }

    public SimpleStringProperty bookNameProperty() {
        return bookName;
    }

    public void setBookName(String bookName) {
        this.bookName.set(bookName);
    }

    public int getBookNumber() {
        return bookNumber.get();
    }

    public SimpleIntegerProperty bookNumberProperty() {
        return bookNumber;
    }

    public void setBookNumber(int bookNumber) {
        this.bookNumber.set(bookNumber);
    }

    public String getAuthor() {
        return author.get();
    }

    public SimpleStringProperty authorProperty() {
        return author;
    }

    public void setAuthor(String author) {
        this.author.set(author);
    }

    public String getPublisher() {
        return publisher.get();
    }

    public SimpleStringProperty publisherProperty() {
        return publisher;
    }

    public void setPublisher(String publisher) {
        this.publisher.set(publisher);
    }

    public double getPrice() {
        return price.get();
    }

    public SimpleDoubleProperty priceProperty() {
        return price;
    }

    public void setPrice(double price) {
        this.price.set(price);
    }

    public String getCategoryName() {
        return categoryName.get();
    }

    public SimpleStringProperty categoryNameProperty() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName.set(categoryName);
    }

    public int getLendingQuantity() {
        return lendingQuantity.get();
    }

    public SimpleIntegerProperty lendingQuantityProperty() {
        return lendingQuantity;
    }

    public void setLendingQuantity(int lendingQuantity) {
        this.lendingQuantity.set(lendingQuantity);
    }

    public int getRemainNumber() {
        return remainNumber.get();
    }

    public SimpleIntegerProperty remainNumberProperty() {
        return remainNumber;
    }

    public void setRemainNumber(int remainNumber) {
        this.remainNumber.set(remainNumber);
    }
}
